package com.liull.netty.itcast.nio.bytebuffer;

import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;

/**
 * @Author: liull
 * @Description: String和ByteBuffer互转
 * @Date: Created in 22:48 2021/7/21
 * @Modified By:
 */
public class String2ByteBufferTest {
    public static void main(String[] args) {
        // 字符串
        String src = "Hello,李燕林";
        // 包装为ByteBuffer
        ByteBuffer buffer = ByteBuffer.wrap(src.getBytes(StandardCharsets.UTF_8));

    }
}
